﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Xmobile.BO;
using System.Data;

namespace Xmobile.Ajax
{
    public partial class downloadcount : System.Web.UI.Page
    {
        private int AppID = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["appid"] != null && Request.QueryString["appid"].ToString() != "")
            {
                if (Libs.CheckInt(Request.QueryString["appid"].ToString()))
                {
                    AppID = Convert.ToInt32(Request.QueryString["appid"].ToString());
                }
            }
            if (!IsPostBack)
            {
                BindData();
            }
        }

        private void BindData()
        {
            DataTable dt = new DataTable();
            dt = BO.Apps.AppsBO.Apps_Select_by_AppID(AppID);
            if (dt != null && dt.Rows.Count > 0)
            {
                BO.Apps.AppsBO.Apps_DownloadFile_AppID(AppID);
                string LinkDownload = dt.Rows[0]["AppLinkDownload"].ToString();
                Response.Redirect(LinkDownload);
            }
        }
    }
}